Allocation of memory regions of a nonvolatile semiconductor memory for stream-based data writing

ABSTRACT

A semiconductor storage device comprises a nonvolatile semiconductor memory with memory regions, threads, and a controller. Each thread includes a buffer region in which write data from a host are stored before the write data are written to one of the memory regions, and the buffer region of each thread is different from buffer regions of the other threads. The controller receives stream data from the host, each stream data being associated with one of multiple stream identifications, allocates each stream identification to one of the threads according to priority levels assigned to the stream identifications, such that a stream identification assigned a highest priority level is allocated to a thread to which none of other stream identifications are allocated, and writes each stream data stored in the buffer regions to one of the memory regions according to stream identification of the stream data.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of U.S. patent application Ser. No.15/826,415, filed Nov. 29, 2017, which application is based upon andclaims the benefit of priority from Japanese Patent Application No.2016-231246, filed Nov. 29, 2016, the entire contents of which areincorporated herein by reference.

FIELD

Embodiments described herein relate generally to a semiconductor storagedevice.

BACKGROUND

In a nonvolatile semiconductor memory, it is required or at leastpreferable to reduce the number of times data is written to and erasedfrom the memory so that the reliability of storage device can bemaintained and read/write performance can be improved. Furthermore, fromthe perspective of cost and power consumption, it is important to limitthe circuit size of a memory controller in a semiconductor storagedevice.

DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a semiconductor storage device according toa first embodiment.

FIGS. 2A and 2B schematically illustrate configurations of a physicalpage and a physical block according to the first embodiment.

FIGS. 3A and 3B schematically illustrate configurations of a logicalpage and a logical block according to the first embodiment.

FIG. 4 is a block diagram for describing a thread according to the firstembodiment.

FIG. 5 illustrates contents of a STREAM CONTROL command in the SCSIspecifications.

FIG. 6 illustrates contents of a WRITE STREAM command in the SCSIspecifications.

FIG. 7 is a sequence diagram for transferring stream data in compliancewith the SAS specifications.

FIG. 8 is a sequence diagram for transferring a plurality of pieces ofstream data in compliance with the SAS specifications.

FIGS. 9A and 9B schematically illustrate a first example of writingstream data to a logical block according to the first embodiment.

FIGS. 10A and 10B schematically illustrate a second example of writingthe stream data to the logical block according to the first embodiment.

FIGS. 11A to 11D schematically illustrate a third example of writing thestream data to the logical block according to the first embodiment.

FIGS. 12A and 12B are graphs for describing a WAF according to the firstembodiment.

FIG. 13 illustrates an example of thread allocation according to thefirst embodiment.

FIG. 14 illustrates an example of thread allocation according to acomparative example.

FIG. 15 illustrates a configuration of a stream control unit accordingto the first embodiment.

FIG. 16 is a block diagram for describing a configuration of astream/thread conversion unit according to the first embodiment.

FIG. 17 illustrates a structure of a stream/thread conversion tableaccording to the first embodiment.

FIG. 18 is a flowchart for an operation by a thread determination unitaccording to the first embodiment.

FIG. 19 is a flow diagram of a method of determining a priority levelaccording to the first embodiment.

FIGS. 20A and 20B schematically illustrate a state when a plurality ofWRITE STREAM commands in the SCSI specifications is issued.

FIGS. 21A and 21B illustrate an example of writing stream data to alogical block according to a second embodiment.

FIG. 22 illustrates an example of the thread allocation according to thecomparative example.

FIG. 23 illustrates a first example of thread allocation according tothe second embodiment.

FIG. 24 illustrates a second example of the thread allocation accordingto the second embodiment.

FIGS. 25A and 25B are time charts for describing an algorithm ofdetermining sequentiality by a semiconductor storage device according tothe second embodiment.

FIGS. 26A to 26G illustrate a transition of a long sequentialdetermination table according to the second embodiment.

FIG. 27 is a flowchart for a procedure of updating the long sequentialdetermination table according to the second embodiment.

FIG. 28 illustrates a configuration of a stream/thread conversion tableaccording to the second embodiment.

FIGS. 29A to 29H illustrate a transition of a long sequentialdetermination table according to a third embodiment.

FIG. 30 illustrates a first example of thread allocation according to afourth embodiment.

FIG. 31 illustrates a first example of thread allocation according tothe comparative example.

FIG. 32 illustrates a second example of the thread allocation accordingto the fourth embodiment.

FIG. 33 illustrates a second example of the thread allocation accordingto the comparative example.

FIGS. 34 and 35 illustrate examples of thread allocation according tothe fourth embodiment.

DETAILED DESCRIPTION

An embodiment is directed to improving reliability, device lifetime, andperformance of a semiconductor storage device.

In general, according to one embodiment, a semiconductor storage devicecomprises a nonvolatile semiconductor memory including a plurality ofmemory regions, a plurality of threads, wherein each thread includes abuffer region in which write data from a host are stored before thewrite data are written to one of the memory regions, and the bufferregion of each of the plurality of threads is different from bufferregions of other threads of the plurality of threads, and a controller.The controller receives a plurality of stream data from the host, eachof the plurality of stream data being associated with one of a pluralityof stream identifications, allocates each of the plurality of streamidentifications to one of the plurality of threads according to prioritylevels assigned to the plurality of stream identifications, such that astream identification assigned a highest priority level is allocated toa thread to which none of other stream identifications are allocated,and writes each stream data stored in the buffer regions to one of theplurality of memory regions according to stream identification of thestream data.

A semiconductor storage device according to an embodiment will bedescribed below with reference to the drawings. It is noted that, in thefollowing description, elements having the same function orconfiguration are given the same reference numeral.

First Embodiment

FIG. 1 is a block diagram of a semiconductor storage device 1 accordinga first embodiment.

A semiconductor storage device 1 includes a memory controller 10 and anonvolatile semiconductor memory 20. In the following description,functional elements necessary for reading data from the nonvolatilesemiconductor memory 20 are omitted.

A memory controller 10 communicates with a host 2 and controls operationof the entire semiconductor storage device 1. The memory controller 10,for example, is a semiconductor integrated circuit that is configured asa system on a chip (SoC).

According to the present embodiment, the host 2 is described as acomputer that supports an interface based on the Serial Attached SCSI(SAS) specifications. However, the host 2 may be a computer thatsupports an interface based on other specifications, for example, SerialATA (SATA) specifications or NVM Express (NVMe®) specifications. Thesemiconductor storage device 1 may be configured in such a manner thatcommunication with a plurality of hosts 2 can be performed.

A nonvolatile semiconductor memory 20 stores data in a nonvolatilemanner. The nonvolatile semiconductor memory 20 according to the presentembodiment is a NAND flash memory, but may be a different type ofnonvolatile semiconductor memory, such as three-dimensionally structuredflash memory, a NOR flash memory, or Magnetoresistive Random AccessMemory (MRAM).

In some cases, the nonvolatile semiconductor memory 20 is hereinafterexpressed as a NAND flash memory 20. The semiconductor storage device 1according to the present embodiment has the NAND flash memory 20 with 16channels (Ch). The memory controller 10 can, in parallel, control theNAND flash memory chips 20 which are connected to the channels,respectively. A plurality of NAND flash memory chips 20 may be connectedto one channel. The NAND flash memory chips 20 that are connected to thechannels are hereinafter expressed as NAND flash memory groups Ch0 toCh15. It is noted that the number of channels may be larger than orsmaller than 16.

The memory controller 10 includes a host interface (IF) control unit100, a buffer management unit 200, a NAND management unit 300, alogical/physical address conversion table 400, and a central processingunit (CPU) 500.

The host IF control unit 100 performs interpretation and execution of acommand received from the host 2. The host IF control unit 100 includesa reception FIFO 110 and a command queue 120.

The reception FIFO 110 temporarily stores write data and a commandreceived from the host 2. The command queue 120 queues the commandreceived from the host 2.

The buffer management unit 200 manages a buffer 210. The buffermanagement unit 200 includes the buffer 210, a stream control unit 220,and a stream/thread conversion unit 230. The buffer 210 temporarilystores write data received from the host 2. The buffer 210 according tothe present embodiment is a memory configured with Static Random AccessMemory (SRAM), but different types of memories, such as Dynamic RandomAccess Memory (DRAM), may be employed for the buffer 210. The streamcontrol unit 220 performs write control of stream data, which will bedescribed later. The stream/thread conversion unit 230 performsconversion of a stream and a thread, which will be described later.

The NAND management unit 300 manages data write to the NAND flash memory20. The NAND management unit 300 includes NAND controllers 310, a bufferread control unit 320, and a block management unit 330. Each of the NANDcontrollers 310 is connected to each of the NAND flash memory groups Ch0to Ch15. The NAND controller 310 controls operations, such as data writeto, data read from, and data erasing from the NAND flash memory 20. Insome cases, the NAND controllers 310 are hereinafter expressed as NANDcontrollers Ch0 to Ch15. The buffer read control unit 320 transfers datathat are read from the buffer 210, to each of the NAND controllers 310.The block management unit 330 prepares a logical block as a data writedestination, for every thread, which will be described later.

The logical/physical address conversion table 400 is used to convert alogical address that is designated in a command received from the host 2to a physical address of the NAND flash memory 20. The CPU 500 performscontrol of the entire semiconductor storage device 1 based on firmware(FW).

It is noted that the buffer 210 and the CPU 500 may be formed as aseparate semiconductor integrated circuit, instead of being built intothe memory controller 10. Furthermore, it is possible that some or allof the functions which, in the following description, are to beperformed by executing the FW are performed by dedicated hardware (HW),and it is possible that some or all of the functions which are to beperformed by HW are performed by executing the FW.

Indexes for evaluating properties of the semiconductor storage device 1include a write amplification factor (WAF). The WAF is determined by thefollowing equation (1).WAF=(a total amount of data written to the NAND flash memory 20)/(atotal amount of write data received from the host 2)  Equation (1)

The WAF varies with the amount of user data being written to the NANDflash memory 20, the amount of management data associated withoperations of the storage device to be written to the NAND flash memory20, the amount of redundant data (such as ECC: error correcting code)being supplied, and the frequency of garbage collection (also referredto as “compaction”) operations. In a NAND flash memory 20, the more datawriting or data erasing operations are performed, the more the storageelements deteriorate. Therefore, it is desirable that the number ofwritings and erasings be kept as small as possible, and it is alsodesirable that the WAF be low.

Next, configurations of a physical page 600 and a physical block 610 ofthe NAND flash memory 20 according to the present embodiment aredescribed with reference to FIGS. 2A and 2B.

As illustrated in FIG. 2A, a minimum unit of management of the data readfrom and the data write to the NAND flash memory 20 is one cluster 620.According to the present embodiment, a size of the cluster 620 is, forexample, 4 kB. Furthermore, a minimum unit for the data read operationor the data write operation within the NAND flash memory 20 is onephysical page 600. That is, data is read from and written to NAND flashmemory on a physical page basis. According to the present embodiment,the size of the physical page 600 is, for example, 16 clusters (4 kB×16clusters=64 kB).

Furthermore, as illustrated in FIG. 2B, a minimum unit for data erasingfrom the NAND flash memory 20 is one physical block 610. That is, in thedata erasing operation, data is erased on a per physical block basis andnot on a per physical page basis. According to the present embodiment,the size of the physical block 610 is 256 clusters, that is, 16 physicalpages (64 kB×16 physical pages=1024 kB). It is noted that a size of eachof cluster, physical block and physical page units is but one example,and the sizes are not limited to the specific values described above.

Next, configurations of a logical page 700 and a logical block 710 aredescribed with reference to FIGS. 3A and 3B.

According to the present embodiment, as illustrated in FIG. 3A, a setincluding the physical pages 600 of their respective NAND flash memorygroups Ch0 to Ch15, in each of which a parallel operation to each othercan be performed, forms a logical page 700. The controller 10 controlsthe data write to the NAND flash memory 20 in units of one logical page700. The controller 10 controls the data read from the NAND flash memory20 in units of one cluster 620. Furthermore, as illustrated in FIG. 3B,the controller 10 controls the data erasing from the NAND flash memory20 in units of one logical block 710, which corresponds to 16 logicalpages 700 of data. That is, the controller 10 performs erasingprocessing on a per logical block 710 basis, and not on a per physicalblock 610 basis (that is, the minimum unit for data erasing of thestorage device is one logical block 710).

Next, a thread 800 is described with reference to FIG. 4.

The memory controller 10 according to the present embodiment manages thepath through which the write data pass before being written to the NANDflash memory 20, and the path is referred to as the thread 800. Thethread 800 includes at least one or several portions of the buffer 210.A circuit that generates an error correction code and the like may beconnected to the thread 800. According to the present embodiment, themaximum number m (where m is a natural number) of threads is 8. However,the maximum number of threads may be larger or smaller than 8. As themaximum number of threads increases, a circuit size of the memorycontroller 10 increases. Therefore, it is typically preferable that themaximum number of threads not be excessively large.

The write data received by the host IF control unit 100 are stored inthe buffer 210 for each thread 800. The write data stored in the buffer210 for each thread 800 are read by the buffer read control unit 320 andtransferred to a NAND controller 310. The buffer read control unit 320transfers each piece of write data to the NAND controller 310 in such amanner that pieces of write data which are stored in the buffer 210 fora plurality of threads 800 are written to one logical block 710. Thatis, the buffer management unit 200 stores write data that is to bewritten to one logical block 710 in one thread 800 of buffer 210.

Furthermore, the CPU 500 performs garbage collection on every thread 800based on control of the FW. That is, when a logical block 710 thatbelongs to a certain thread 800 is selected as a garbage collectionsource block, the CPU 500 selects a garbage collection destination blockfrom the logical blocks 710 that belong to the same thread 800. Thelogical block 710 that is the garbage collection source block is thenused for a data write to the thread 800 after the data are erased.

The configuration of the semiconductor storage device 1 according to thepresent embodiment is described above. An outline of a stream data writewill be described in the following.

Recently, in order to reduce the number of Program/Erase cycles of anonvolatile semiconductor memory, a technique has been introduced, inwhich data having the same expected life cycle are handled as a set.That is, a set of data (which is hereinafter referred to as stream data)that is expected to be collectively invalidated by a host, iscollectively written to the same memory block (which is the unit oferasing) in the nonvolatile semiconductor memory.

In order to invalidate certain data, the host (a) issues a write commandthat designates a logical address related to the certain data andtransmits write data, (b) issues a command (for example, an UNMAPcommand that is stipulated in the SCSI specifications, or a TRIM commandthat is stipulated in the ATA specifications) that instructs theinvalidation of the data, (c) issues a command (for example, a FORMATUNIT command that is stipulated in the SCSI specifications) thatprovides an instruction to initialize all allocated areas of the storagedevice, or the like.

FIGS. 5 and 6 illustrate contents of a command according to the SCSIspecifications that include SAS specifications, which is used for thestream data write.

The STREAM CONTROL command illustrated in FIG. 5 is a command with whichthe host 2 requests to the semiconductor storage device 1 for assignmentof an identifier for identifying each piece of stream data (referred toherein as a stream ID). The STREAM CONTROL command is also used in orderfor the host 2 to request to the semiconductor storage device 1 forreleasing the stream ID that is no longer necessary.

STR_CTL field indicates which of the assignment (OPEN) of the stream IDand the releasing (CLOSE) of the stream ID the STREAM CONTROL commandrequests for. When STR_CTL field is 01b, this means an assignmentrequest (OPEN). At this time, STR_ID field is a “don't care”. On theother hand, when STR_CTL field is 10b, this means a releasing request(CLOSE). The stream ID that has to be released is designated in STR_IDfield. The STREAM CONTROL command of which STR_CTL field is 01b ishereinafter expressed as the STREAM CONTROL (OPEN) command, and theSTREAM CONTROL command of which STR_CTL field is 10b is hereinafterexpressed as the STREAM CONTROL (CLOSE) command.

The WRITE STREAM command illustrated in FIG. 6 is a command that is usedfor the stream data write. The host 2 designates the stream ID that isassigned by the semiconductor storage device 1 in response to the STREAMCONTROL (OPEN) command, to STR_ID field, and issues the command to thesemiconductor storage device 1.

Next, one example of a protocol in a case where the stream data istransferred in compliance with the SAS specifications is described withreference to FIG. 7. It is noted that, for simplification, a detaileddescription of some frames that are necessary for command execution incompliance with the SAS specifications, such as a XFER_RDY frame, aRESPONSE frame, a DATA frame, or the like is omitted.

First, host 2 issues a STREAM CONTROL (OPEN) command to requestassignment of a stream ID. The semiconductor storage device 1 performsprocessing, such as allocating an available space in the buffer 210, andthen notifies the host 2 that stream ID=1 is assigned. In the samemanner, the semiconductor storage device 1 notifies the host 2 thatstream IDs=2 and 3 are assigned.

The host 2 issues WRITE STREAM commands using the assigned stream IDs=1,2, and 3, and transfers the stream data. The host 2 knows (oranticipates) a life cycle of each piece of stream data. The host 2 doesnot transfer pieces of data that have different life cycles using thesame stream ID. For example, all pieces of stream data that aretransferred with the WRITE STREAM command for stream ID=1, are expectedto be collectively invalidated by host 2.

When the transfer of the stream data is completed, the host 2 issuesSTREAM CONTROL (CLOSE) commands to request for the releasing of streamIDs=1, 2, and 3 that are no longer necessary.

It is noted that the stream data may be transferred with a protocolother than the one described above. For example, a protocol may beemployed in which a stream ID that has become unnecessary is notexplicitly released.

Commands can be queued and are executed in compliance with the SASspecifications. One example of queuing is illustrated in FIG. 8. In FIG.8, transfer of stream data that have the streaming IDs=1, 2, and 3 isperformed and each piece of stream data is transferred with three DATAframes respectively. Here, before completing a transfer of stream datawith a stream ID, another transfer of stream data with another stream IDmay be carried out. For example, before completing the transfer ofstream data of three frames with the stream ID=1, the stream data withthe stream ID=2 or the stream ID=3 may be performed.

An outline of the stream data write has been described above. How thesemiconductor storage device 1 according to the present embodimentwrites the stream data to the NAND flash memory 20 will be described inthe following.

FIG. 9A illustrates a state in which pieces of stream data that have thesame stream ID are written in one logical block 710. The stream datathat have stream ID=1 are written in a certain logical block 710 (whichis defined as logical block #1).

FIG. 9B illustrates a state after the state in FIG. 9A, when the host 2has invalidated the stream data that have stream ID=1. As describedabove, the pieces of stream data that have the same stream ID areexpected to be collectively invalidated by the host 2. The invalidationof the pieces of stream data that have stream ID=1 invalidates all datawritten in logical block #1. In this state, by erasing the logical block#1 without requiring garbage collection, the logical block #1 can beregarded as a free logical block. A free logical block does not containany valid data and becomes an erased logical block by erasing.

FIG. 10A illustrates a state in which pieces of stream data that havetwo different stream IDs are written mixed in one logical block 710.Here, stream data that have stream ID=1 and the stream data that havestream ID=2 are written in a certain logical block 710 (which is definedas logical block #2).

FIG. 10B illustrates a state after the state in FIG. 10A, when the host2 has invalidated the stream data that have stream ID=1. Theinvalidation of the stream data that have stream ID=1 invalidates thestream data that have stream ID=1 among pieces of data that are writtenin logical block #2. However, the stream data that have stream ID=2 havenot been invalidated. In this state, the stream data that have thestream ID=2, which are still valid among pieces of data that werewritten in logical block #2, must be copied to a different logical block710 (for example, a logical block #3 that is not specificallyillustrated) before regarding logical block #2 as a free logical block(that is, the garbage collection must be completed), and then erasingdata from logical block #2 can be performed.

When the stream data are written in the NAND flash memory 20 asillustrated in FIG. 10A, a total amount of data that must be written inthe NAND flash memory 20 for obtaining the free logical block is largerthan that in the case in FIG. 9A. That is, the write amplificationfactor (WAF) is larger.

FIG. 11A illustrates a state in which pieces of stream data that havethree stream IDs are written in one logical block 710. The stream datathat have stream ID=1, the stream data that have stream ID=2, and thestream data that have stream ID=3 are written in a certain logical block710 (which is defined as logical block #4).

FIG. 11B illustrates a state after the state in FIG. 11A, when the host2 has invalidated the stream data that have stream ID=1. Theinvalidation of the stream data that have stream ID=1 invalidates thestream data that have stream ID=1 among pieces of data that are writtenin logical block #4. However, the stream data that have stream ID=2 andthe stream data that have stream ID=3 are not invalidated. In thisstate, the stream data that have the stream ID=2 and the stream datathat have stream ID=3, which are still valid among pieces of data thatare written in logical block #4, have to be copied to a differentlogical block 710 (for example, logical block #5) (that is, after thegarbage collection is performed) before erasing data from logical block#4 is performed.

FIG. 11C illustrates a state after, as described above, the stream datathat have stream ID=2 and the stream data that have stream ID=3 arewritten to logical block #5 by the garbage collection.

FIG. 11D illustrates a state after the host 2 has invalidated the streamdata that have stream ID=2 after the state in FIG. 11C. The stream datathat have stream ID=2 among pieces of data that have been written inlogical block #5 are invalidated. However, the stream data that havestream ID=3 are not invalidated. To set logical block #5 as a freelogical block, the stream data that have the stream ID=3 in logicalblock #5, have to be copied to a different logical block 710 (forexample, a logical block #6 that is not illustrated) (that is, thegarbage collection is performed), and then erasing data from logicalblock #5 can be performed.

When the stream data are written in the NAND flash memory 20 asillustrated in FIG. 11A or FIG. 11C, the erasing process for a logicalblock requires copying of data to a different logical block, so a totalamount of data that has to be written (or copied) in the NAND flashmemory 20 is larger more than in the case in FIG. 10A. That is, the WAFis larger.

As described above, when the pieces of stream data that have more thanone stream IDs are written in one logical block 710, the WAF increaseswith the increase in the number of different stream IDs of the pieces ofstream data that are written in said one logical block 710.

This outcome is described with reference to FIGS. 12A and 12B. In a casewhere only pieces of stream data that have one stream ID are written inone logical block 710 the WAF is one, because the logical block 710 canbe simply be designated as a free logical block without the need ofperforming the garbage collection. However, when the pieces of streamdata written in one logical block 710 have a plurality of stream IDs,garbage collection has to be performed to regard the logical block 710to be a free logical block. Therefore, the WAF increases.

As illustrated in FIG. 12A, the WAF increases with the increase in thenumber of the stream IDs of the pieces of stream data that are writtenin one logical block 710, and approaches a random WAF level. The randomWAF here is the WAF when it is assumed that pieces of completely randomdata, that is, pieces of data that are invalidated at different pointsin time, are written in one logical block 710.

It is noted that a value of the WAF in the case where the pieces ofstream data that have a plurality of stream IDs are written in onelogical block 710 changes according to a ratio of an overprovisioningcapacity to a user capacity (an OP ratio). The user capacity is thememory storage capacity that corresponds to an address range that isable to be designated by the host 2. The overprovisioning capacity isthe difference between the user capacity and the physical capacity thatis the actual memory capacity of the NAND flash memory 20.

In FIG. 12B, the WAF is illustrated along the vertical axis and the OPratio along the horizontal axis. As illustrated in FIG. 12B, althoughthe same OP ratio applies, the WAF increases as the number of stream IDsthat are written in one logical block 710 increases. Furthermore, in acase where the numbers of stream IDs that are written in one logicalblock 710 are the same, the WAF decreases as the OP ratio increases. Forexample, in a case where the OP ratio is 0.1, the WAF is approximately3.2 when pieces of stream data that have two stream IDs are written inone logical block 710. And when pieces of stream data that have fourstream IDs are written in one logical block 710 and the OP ratio remains0.1, the WAF is approximately 4.3. It is noted that, as described above,the WAF is 1 regardless of the OP ratio when only pieces of stream datathat have the same stream ID are written in one logical block 710.

According to the present embodiment, the WAF for every thread 800 (a“local WAF” or a “thread WAF”) is defined by the following equation:local WAF=(a total amount of write data received from host 2 for acertain thread 800+a total amount of write data in response to garbagecollection to the certain thread 800)/(the total amount of write datareceived from the host 2 for the certain thread 800)  Equation (2)

Furthermore, the WAF of the entire semiconductor storage device 1 (a“device WAF” or a “total WAF”) is expressed (Equation (3)) using thelocal WAF as follows:device WAF=Σβi×local WAF i  Equation (3)

In Equation (3) i is the number (i=1 to 8 according to the presentembodiment) of the thread 800, local WAF i is a local WAF for thread #i,and βi is a coefficient for every thread 800. The coefficient βi may beexpressed (Equation (4)) as follows:βi=(a throughput at which write data that is received from the host 2 iswritten to the NAND flash memory 20 via thread #i)/(a throughput atwhich all pieces of write data received from the host 2 are written tothe NAND flash memory 20)  Equation(4)

(The write data shown here does not contain the one written by thegarbage collection process.)

The throughput and the total amount of pieces of write data that arewritten to the NAND flash memory 20 per unit time are proportional toeach other. The throughput here is a throughput of data transfer betweenthe host 2 and the semiconductor storage device 1. The throughput ishereinafter referred to as a host throughput.

Next, an example of allocation of the threads 800 by the stream/threadconversion unit 230 according to the present embodiment is describedwith reference to FIG. 13. For simplification, it is assumed here thatthe semiconductor storage device 1 has a maximum of four threads 800. Asdescribed in FIG. 12B, the WAF is assumed to be 3.2 when pieces ofstream data that have two stream IDs are written to one logical block710. As described above, the WAF is assumed to be one when only piecesof stream data that have one stream ID are written to one logical block710.

Five pieces of stream data that have the stream IDs=1 to 5 aretransmitted from the host 2. Host throughputs of the stream data thathave stream ID=1, the stream data that have stream ID=2, the stream datathat have stream ID=3, the stream data that have stream ID=4, and thestream data that have stream ID=5 are 1200 MB/s, 1100 MB/s, 1000 MB/s,500 MB/s, and 400 MB/s, respectively. A method of calculating the hostthroughput will be described below.

The stream/thread conversion unit 230 stores the five pieces of streamdata that have stream IDs=1 to 5 in the buffers 210 of four threads 800(thread #1 to thread #4). This is hereinafter expressed as, for example,stream ID=1 is allocated to thread #1. As described above, it is notpreferable that the total number of threads increases excessively.According to the present embodiment, when the total number of stream IDsis larger than the number of available threads, then allocation of thethreads is performed as in the following.

The stream/thread conversion unit 230 prioritizes the allocation ofthreads to the stream ID that has a high host throughput. That is, herestream IDs=1, 2, and 3 are allocated to thread #1, thread #2, and thread#3, respectively. Furthermore, stream IDs=4 and 5 that have a low hostthroughput are allocated to thread #4 in a mixed/joint manner.

As described above, the WAF is one when pieces of stream data that haveone stream ID are written to just one logical block 710. Therefore, thelocal WAFs of thread #1, thread #2, and thread #3 are 1.

Furthermore, when it comes to βi, according to Equation (4), thenβi==1200/(1200+1100+1000+500+400)=0.286,β2=1100/(1200+1100+1000+500+400)=0.262, andβ3=1000/(1200+1100+1000+500+400)=0.238.

On the other hand, the WAF is 3.2 when pieces of stream data that havetwo stream IDs are written to one logical block 710. Therefore, thelocal WAF of thread #4 is 3.2. When it comes to β4, because the hostthroughput of the stream data that are stored in the buffer 210 ofthread #4 is 500 MB/s (stream ID=4)+400 MB/s (stream ID=5)=900 MB/s,β4=900/(1200+1100+1000+500+400)=0.214 according to Equation (4).

Therefore, when it comes to the device WAF when the stream IDs areallocated to the threads as illustrated in FIG. 13, the deviceWAF=0.286×1+0.262×1+0.238×1+0.214×3.2=1.47 according to Equation (3).

Next, an example of allocation of threads 800 by a stream/threadconversion unit 230 according to a comparative example is described withreference to FIG. 14.

The host throughput of the stream data transmitted from the host 2 isthe same as in the case in FIG. 13. However, here the stream/threadconversion unit 230 in the comparative example allocates stream IDs=1and 2 that have the highest host throughputs to thread #1 in amixed/joint manner. Furthermore, the stream/thread conversion unit 230in the comparative example allocates stream IDs=3, 4, and 5 that havelower host throughputs to thread #2, thread #3, and thread #4,respectively. As a result of allocating the stream IDs to the threads800 in this manner, when it comes to βi,β1=2200/(1200+1100+1000+500+400)=0.523,β2=1000/(1200+1100+1000+500+400)=0.238,β3=500/(1200+1100+1000+500+400)=0.119, andβ4=400/(1200+1100+1000+500+400)=0.095. Therefore, in the comparativeexample, the device WAF=0.523×3.2+0.238×1+0.119×1+0.095×1=2.13. Thus, itcan be understood that the device WAF is larger than in the caseaccording to the present embodiment. Therefore, allocating the threadssuitably is important to minimize the device WAF.

Next, a configuration of the stream control unit 220 according to thepresent embodiment is described in detail with reference to FIG. 15.

The stream control unit 220 includes a stream ID management table 222for managing the stream IDs that are assigned to the host 2. The streamID management table 222 in FIG. 15 has a stream ID column, an open flagcolumn, and an active flag column. According to the present embodiment,stream IDs=1 to 16 can be assigned to the host 2.

When receiving the STREAM CONTROL (OPEN) command from the host 2, theCPU 500 searches for the stream IDs that are available for assignmentaccording to the stream ID management table 222, based on the control inaccordance with the FW. The CPU 500 controls the host IF control unit100 in such a manner that the allocated stream ID (which is hereinafterreferred to as an open stream ID) is notified to the host 2. At thistime, the CPU 500 sets the open flag in the stream ID management table222 for the stream ID.

Furthermore, when the stream data start to be transferred from the host2, the host IF control unit 100 reads a header of a DATA frame andnotifies the stream control unit 220 of a stream ID of each piece ofstream data (that is, a stream ID of the stream data that actually startto be transferred from the host 2, which is hereinafter referred to asan active stream ID).

Upon being notified of the active stream ID, the stream control unit 220sets the active flag in the stream ID management table 222 for thestream ID.

After the transfer of the stream data is completed, when the host 2issues the STREAM CONTROL (CLOSE) COMMAND to request for the releasingof the stream. ID that is no longer necessary, the CPU 500 clears theopen flag and the active flag in the stream ID management table 222 forthe stream ID.

In FIG. 15, the assignment of stream IDs=1, 2, 3, and 4 to the host 2 iscompleted, and the stream data start to be transferred for the streamIDs=1 and 2.

Next, a configuration of the stream/thread conversion unit 230 accordingto the present embodiment is described with reference to FIGS. 16 and17. FIG. 16 is a block diagram of the stream/thread conversion unit 230.FIG. 17 illustrates a configuration of stream/thread conversion table232 that the stream/thread conversion unit 230 includes. Thestream/thread conversion table 232 has entries of which the number (16according to the present embodiment) is the same as that of stream IDsthat is can be assigned to the host 2. Each entry in the stream/threadconversion table 232 includes a stream ID, a host throughput, a prioritylevel, and a thread ID.

As illustrated in FIG. 16, a host throughput for every stream ID isinput into the stream/thread conversion unit 230 from the host IFcontrol unit 100. A method of calculating the host throughput will bedescribed later, but the calculation may be performed either of when thestream ID is initially assigned to the host 2 or when the stream dataactually start to be transferred from the host 2.

The stream/thread conversion unit 230 stores the host throughput that isinput from the host IF control unit 100 in the stream/thread conversiontable 232. The thread determination unit 234 determines a priority levelof each stream ID from the host throughput that is stored in thestream/thread conversion table 232. Furthermore, the threaddetermination unit 234 determines which thread is allocated to eachstream ID. The thread determination unit 234 stores the priority leveland the thread ID in the stream/thread conversion table 232.

The thread determination unit 234, in general, determines that thestream IDs that have the higher host throughput have the higher prioritylevels. In a case where a plurality of stream IDs that are equal in thehost throughput, the priority level of the stream ID having smaller IDnumber may be higher.

The thread determination unit 234 allocates the stream IDs from a firstranked priority level to a (m−n)-th ranked priority level (where m isthe maximum number of threads and n is a natural number that is equal toor greater than one and less than m) to thread #1 to thread #(m−n),respectively. The threads to which the stream IDs from the first rankedpriority level to the (m−n)-th ranked priority level are allocated arehereinafter referred to as dedicated threads.

The thread determination unit 234 allocates the stream IDs that have the(m−n+1)-th ranked priority level or lower, to thread #(m−n+1) to thread#m. The thread to which the stream IDs that have the (m−n+1)-th rankedpriority level or lower are allocated is hereinafter referred to as amixing thread. In a case where there is a plurality of mixing threads,that is, in a case where n 2, the numbers of stream IDs that areallocated to each mixing thread need not be the same.

In a case where it is assumed that m=8 and n=1, thread #1 to thread #7are the dedicated threads, and thread #8 is the mixing thread.

It is noted that an ID of a thread that is used as a dedicated threadmay be other than #1 to #(m−n). An ID of a thread that is used as amixing thread may be other than #(m−n+1) to #m.

The host IF control unit 100 causes the stream/thread conversion unit230 to receive the stream data and to be notified of the stream. ID ofthe stream data. A data selection unit 236 searches the stream/threadconversion table 232 with the notified stream ID as an index, andselects which thread 800 the stream data are transferred to.

FIG. 17 illustrates one example of information that is stored in thestream/thread conversion table 232. At this point, it is assumed thatn=1.

Host throughputs of the stream data that have stream ID=1, the streamdata that have stream ID=2, the stream data that have stream ID=3, thestream data that have stream ID=4, the stream data that have streamID=5, the stream data that have stream ID=6, the stream data that havestream ID=7, and the stream data that have stream IDs=8 to 16 are 1200MB/s, 1100 MB/s, 1050 MB/s, 1000 MB/s, 950 MB/s, 900 MB/s, 850 MB/s, and100 MB/s, respectively.

Priority levels of the stream IDs are determined in descending order ofthe host throughputs. Stream IDs=1 to 7 that have first to seventhranked priority levels are allocated to thread #1 to thread #7,respectively, all of which are the dedicated threads. Stream IDs=8 to 16that have eighth to sixteenth ranked priority levels are collectivelyallocated to thread #8, which is the mixing thread.

Next, an operation by the thread determination unit 234, of performingthread allocation is described with reference to FIG. 18.

When the host throughput is input from the host IF control unit 100(S100), the thread determination unit 234 performs allocation in such amanner that the higher the host throughput, the higher priority levelthat is allocated (S101). The thread determination unit 234 allocatesthe stream IDs from the first ranked priority level to the (m−n)-thranked priority level to the dedicated threads (S102). In a case wherethere is a stream ID to which no thread is not allocated (Yes in S103),the thread determination unit 234 allocates the stream ID that has the(m−n+1)-th ranked priority level or lower, to the mixing thread (S104).

It is noted that thread determination unit 234 allocates the write datato which a stream ID has not been assigned (that is, the write data thatare not stream data) to the mixing thread.

The semiconductor storage device 1 according to the present embodimentwrites the stream data to the NAND flash memory 20 as described above.

Next, variations of method for determining the priority level of everystream ID is described with reference to FIG. 19.

Determination (setting) of the priority level can be performed by thehost 2 or the semiconductor storage device 1.

In a case where the host 2 determines the priority level (S200), thehost 2 measures a host throughput between the host 2 and thesemiconductor storage device 1 (S201) and determines the priority level.The determined priority level is notified to the semiconductor storagedevice 1, for example, with the STREAM CONTROL (OPEN) command. It isnoted that, in this case, processing in each of S100 and S101 in FIG. 18is skipped.

In a case where the semiconductor storage device 1 determines thepriority level (S202), the semiconductor storage device 1 determines thepriority level based on the host throughput. In this case, determinationof the host throughput can be performed by the host 2 or thesemiconductor storage device 1.

In a case where the host 2 determines the host throughput (S203), thehost 2 measures the throughput between the host 2 and the semiconductorstorage device 1, and determines the host throughput. The present stepis the same as S201. The determined host throughput is notified to thesemiconductor storage device 1, for example, by the STREAM CONTROL(OPEN) command. Then, the semiconductor storage device 1 determines thepriority level based on the notified host throughput.

In a case where the semiconductor storage device 1 determines the hostthroughput (S204), a method that uses actual measurement (S205) or amethod that uses a queue depth of the commands (S206) is used.

In a case where the method that uses the actual measurement is employed(S205), the semiconductor storage device 1 may determine the hostthroughput, for example, according to the number of WRITE STREAMcommands that are completed within a past fixed period of time (which isdefined as time period T1). In this case, a data transfer length forevery WRITE STREAM command may be taken into account. Specifically, thethroughput may be determined by dividing by time period T1 a sum of datalengths transferred with the WRITE STREAM commands within time periodT1.

In a case where the method that uses the queue depth of the commands isused (S206), the host throughput cannot be determined precisely, but thesemiconductor storage device 1 determines the host throughput from anestimation as will be described below. That is, for example, thesemiconductor storage device 1 estimates the host throughput based onthe number of WRITE STREAM commands that are queued in the command queue120 at certain time point T2. Also in this case, the data transferlength for every WRITE STREAM command may be taken into account.Specifically, the host throughput is estimated based on a sum of datalengths that have to be transferred with the WRITE STREAM commands whichare queued in the command queue 120 at time point T2.

Then, the semiconductor storage device 1 determines the priority levelbased on the host throughput determined by the semiconductor storagedevice 1 itself.

According to the semiconductor storage device according to the firstembodiment, as described above, because a dedicated thread is allocatedwith higher priority to a stream ID that has a higher host throughput,the WAF of the semiconductor storage device can be reduced.

Second Embodiment

In the semiconductor storage device according to the first embodiment,in general, a higher priority level is allocated to the stream. IDs thathave a higher host throughput, and available threads are allocatedaccording to the priority level. In contrast, in a semiconductor storagedevice according to the second embodiment, the allocation of the threadscan be arranged based on the sequentiality of the pieces of data in thestream data. According to the second embodiment, an attempt is made toallocate the threads more suitably based on the assumption thatsequential pieces of data will be collectively invalidated in a highprobability (for example, in a case where the data constitutes portionsof the same file) even in a case where pieces of stream data that aretransferred using the same stream ID may not be collectivelyinvalidated.

FIG. 20A is a sequence diagram for describing one example in which thehost 2 issues a plurality of WRITE STREAM commands using the stream ID.

Using the stream ID=1, the host 2 issues each of four WRITE STREAMcommands, the transfer length=0x50 sectors from start LBA=0x0000, thetransfer length=0x30 sectors from start LBA=0x0100, the transferlength=0x80 sectors from start LBA=0x0500, and the transfer length=0x100sectors from start LBA=0x0800.

Furthermore, using the stream ID=2, the host 2 issues each of two WRITESTREAM commands, the transfer length=0x800 sectors from startLBA=0x1000, and the transfer length=0x800 sectors from start LBA=0x1800.

LBAs of the stream data that are transmitted from the host 2 at thistime are as illustrated in FIG. 20B. A solid line portion of FIG. 20Billustrates LBA ranges in which the stream data are transmitted. Adotted line portion of FIG. 20B illustrates LBA ranges in which thestream data are not transmitted. The stream data that have stream ID=1have low sequentiality (or high randomness), and the stream data thathave stream ID=2 have high sequentiality. Here, “sequentiality” refersto a degree of contiguity among logical addresses of neighboringcommands in sequence in the data stream. A sequential access pattern, inwhich logical addresses of commands are contiguous, has a highsequentiality. A random access pattern, in which logical addresses ofcommands are random, has a low sequentiality.

FIG. 21A illustrates a state in which two pieces of sequential data thathave the same stream ID are written in one logical block 710. Streamdata that have stream ID=1·sequential #1 (for example, LBA=0x0000 to0x1000) and stream data that have stream ID=1·sequential #2 (forexample, LBA=0x2000 to 0x3000) are written in a certain logical block710 (which is defined as logical block #1).

FIG. 21B illustrates a state after the state in FIG. 21A, the host 2invalidates the stream data that have stream ID=1·sequential #1.Invalidation of the stream data that have stream ID=1·sequential #1invalidates the stream data among pieces of data that are written inlogical block #1. However, stream data that have stream ID=1·sequential#2 are not invalidated. In this state, the stream data that have streamID=1·sequential #2, which are still valid among pieces of data that arewritten in logical block #1, should be copied to a different logicalblock 710 (for example, logical block #2 that is not illustrated) (thatis, the garbage collection is required), before erasing logical block#1.

Therefore, when FIGS. 10A and 10B (describing aspects of firstembodiment) and FIGS. 21A and 21B (describing aspects of the secondembodiment) are compared, in FIGS. 21A and 21B, a total amount of datathat should be written to the NAND flash memory 20 increases to obtainthe same number of free logical blocks. That is, stream data that havelow sequentiality increases the WAF.

Next, an example of the allocation of the thread 800 by thestream/thread conversion unit 230 according to the second embodiment isdescribed with reference to FIGS. 22 to 24.

As illustrated in FIG. 22, it is assumed that five pieces of stream datathat have stream IDs 1 to 5 are transmitted from the host 2. Hostthroughputs of pieces of stream data that have stream IDs=1 to 3 andpieces of stream data that have stream IDs=4 and 5 are 1100 MB/s and1000 MB/s, respectively. It is assumed that the pieces of stream datathat have stream IDs=1 to 3 have high randomness, and the pieces ofstream data that have stream IDs 4 to 5 have high sequentiality. It isassumed here that the semiconductor storage device 1 has a maximum ofthree threads 800.

At this time, according to a thread allocation conditions described inthe first embodiment, stream ID=1 is allocated to thread #1, which is adedicated thread. Stream ID=2 is allocated to thread #2, which is adedicated thread. Stream IDs=3 to 5 are allocated to thread #3, which isa mixing thread. As a result, the stream IDs (stream IDs=1 to 3) thathave high randomness are allocated to one of threads #1 to #3. As such,the local WAF of each of threads #1 to #3 approaches the random WAF.

FIG. 23 illustrates an example of the allocation of the thread 800 bythe stream/thread conversion unit 230 according to the secondembodiment. The stream data that are transmitted from the host 2 in FIG.23 are the same as that in FIG. 22.

The stream/thread conversion unit 230 according to the second embodimentallocates stream IDs=1 to 3 that have high randomness, to thread #3,which is the mixing thread. Stream ID=1 that has high sequentiality isallocated to thread #1, which is the dedicated thread. Stream ID=2 thathas high sequentiality is allocated to thread #2, which is the dedicatedthread. As a result, only the local WAF of thread #3 approaches therandom WAF. On the other hand, the local WAF of thread #1 to which thestream data that have high sequentiality are allocated, when thesepieces of stream data are assumed to be collectively invalidated, isone. In the same manner, the local WAF of thread #2 is also one.

FIG. 24 illustrates another example of the allocation of the thread 800by the stream/thread conversion unit 230 according to the secondembodiment. As illustrated in FIG. 24, it is assumed that three piecesof stream data, stream IDs=1 to 3, are transmitted from the host 2.Stream ID=1 is assumed to be one piece of sequential data. Stream ID=2is assumed to include a plurality of pieces of sequential data. StreamID=3 is assumed to be random data. At this point, it is assumed that thesemiconductor storage device 1 has a maximum of two threads 800.

In a case where a plurality of pieces of sequential data is transmittedwith one stream ID, the stream/thread conversion unit 230 according tothe present embodiment allocates the stream ID to the mixing thread.That is, stream ID=2 that includes a plurality of pieces of sequentialdata is allocated to thread #2, which is the mixing thread, along withstream ID=3 that has the random data.

As described briefly above, the stream/thread conversion unit 230according to the present embodiment allocates the thread in accordancewith the sequentiality of the stream data. As a result, the WAF of theentire device can be reduced.

Next, an outline of an algorithm for determining sequentiality isdescribed with reference to FIGS. 25A and 25B. FIGS. 25A and 25Billustrate the start LBAs and the transfer lengths of pieces of streamdata (which are referred to as data (A) to data (E)) that aretransferred with WRITE STREAM command (A) to WRITE STREAM command (E).

In the semiconductor storage device 1 according to the secondembodiment, the stream control unit 220 determines the sequentiality byusing the start LBA and the transfer length, which are input from thehost IF control unit 100. The stream control unit 220 stores the startLBA as a reference for pieces of stream data that have the same streamID. That is, in an example illustrated in FIG. 25A, the stream controlunit 220 stores the start LBA of data (A) as the reference. The streamcontrol unit 220 stores the accumulation amount, which results fromaccumulating transfer lengths of each of data (B) to data (E) that havean LBA range which is contiguous to an LBA range of data (A). Then, uponreception of data (D), the accumulation amount is equal to or largerthan a long sequential determination threshold value that is set inadvance, the stream control unit 220 determines that the sequentialityof the stream data is high.

Depending on the way in which the host 2 transfers the stream data, thesemiconductor storage device 1 may not always receive, in LBA order, thestream data that have high sequentiality. In an example illustrated inFIG. 25B, the semiconductor storage device 1 receives pieces of streamdata in the following order: data (B), data (A), data (C), data (D), anddata (E). The stream control unit 220 can also determine thesequentiality of the pieces of stream data that are received even inthis out-of-order manner.

Next, one example of a configuration of a long sequential determinationtable is described with reference to FIGS. 26A to 26G. The longsequential determination table can be built into the stream control unit220. The stream control unit 220 determines the sequentiality of thestream data by using the long sequential determination table.

The long sequential determination table has a plurality of entries(rows). According to the second embodiment, the long sequentialdetermination table has three entries. Each entry includes start LBA,end LBA, the accumulation amount, and a generation number. Furthermore,the long sequential determination table has a long determination flagregister. The long sequential determination table is managed for everystream ID. That is, there is one long sequential determination table foreach stream ID. The long sequential determination table may beinitialized by the CPU 500 when the stream ID is assigned according tothe STREAM CONTROL (OPEN) command.

In the following description, it is assumed that 0x700 is set for a longsequential determination threshold value.

FIG. 26A illustrates a state in which the long sequential determinationtable is initialized. Although omitted in FIG. 26A, all entries, thatis, the start LBA, the end LBA, the accumulation amount, and thegeneration number are zero. The long determination flag is not set.

FIG. 26B illustrates a state of the long sequential determination tablewhen the WRITE STREAM command (command A) designating the transferlength=0x200 sectors from start LBA=0x1000 is issued in a state in FIG.26A. The start LBA at entry 0 is set as 0x1000. The end LBA is the startLBA+the transfer length−1 and thus is set as 0x11FF. The accumulationamount at entry 0 results from adding the transfer length of command A(0x200) to the existing accumulation amount (0x000), and thus is set as0x200. The generation number at the entry at which command informationis newly registered is one. That is, the generation number at entry 0 isset as one.

FIG. 26C illustrates a state of the long sequential determination tablewhen the WRITE STREAM command (command B) designating the transferlength=0x100 sectors from start LBA=0x1200 is issued in a state in FIG.26B. The start LBA of command B is contiguous to the end LBA at entry 0.Therefore, information of command B is registered at entry 0. The startLBA at entry 0 remains 0x1000, and the end LBA is updated to 0x12FF,which is the end LBA of command B. The accumulation amount at entry 0results from adding the number of transfers of command B (0x100) to theexisting accumulation amount (0x200), and thus is updated to 0x300. Thegeneration number at the entry that has the LBA range which iscontiguous to the LBA range of the received command is set to one. Thatis, the generation number at entry 0 remains one.

FIG. 26D illustrates a state of the long sequential determination tablewhen the WRITE STREAM command (command C), the transfer length=0x200sectors from start LBA=0x1400 is issued in a state in FIG. 26C. Thestart LBA of command C is not contiguous to the end LBA at entry 0. Atthis time, information of command C is registered at entry 1. The startLBA at entry 1 is set as 0x1400, and the end LBA is set as 0x15FF. Theaccumulation amount at entry 1 results from adding the number oftransfers of command C (0x200) to the existing accumulation amount(0x000), and thus is set as 0x200. The generation number at the entry atwhich the command information is newly registered is one. That is, thegeneration number at entry 1 is set as one. At entries at which theaccumulation amount is not zero other than the entry at which thecommand information is newly registered, the generation number isincremented by one. That is, the generation number at entry 0 is updatedto two.

FIG. 26E illustrates a state of the long sequential determination tablewhen the WRITE STREAM command (command D) designating the transferlength=0x100 sectors from start LBA=0x0E00 is issued in a state in FIG.26D. The start LBA of command D is not contiguous to any one of the endLBA at entry 0 and the end LBA at entry 1. At this time, information ofcommand D is registered at entry 2. The start LBA at entry 2 is set as0x0E00 and the end LBA is set as 0x0EFF. The accumulation amount atentry 2 results from adding the transfer length of command D (0x100) tothe existing accumulation amount (0x000), and thus is set as 0x100. Thegeneration number at the entry at which the command information is newlyregistered is one. That is, the generation number at entry 2 is set asone. At entries at which the accumulation amount is not zero other thanthe entry at which the command information is newly registered, thegeneration number is incremented by one. That is, the generation numberat entry 0 is updated to three. The generation number at entry 1 isupdated to two.

FIG. 26F illustrates a state of the long sequential determination tablewhen the WRITE STREAM command (command E) designating the transferlength=0x100 sectors from start LBA=0x1300 is issued in a state in FIG.26E. The start LBA of command E is contiguous to the end LBA at entry 0.Furthermore, the end LBA of command E is contiguous to the start LBA atentry 1. At this time, information at entry 0, information at entry 1,and information of command E are merged, and a result of the merging isregistered at an entry at which the start LBA is smallest, that is, atentry 0. The start LBA at entry 0 remains 0x1000. The end LBA at entry 0is updated to 0x15FF, which is the end LBA at entry 1. The accumulationamount at entry 0 results from adding the accumulation amount at entry 1(0x200) and the number of transfers of command E (0x100) to the existingaccumulation amount (0x300), and thus is updated to 0x600. At theentries that are merged, the generation number at the entry at which thestart LBA is smallest is one. That is, the generation number at entry 0is updated to one. Among the entries that are merged, the entry at whichthe start LBA is not smallest is initialized. That is, entry 1 isinitialized. The generation numbers of the entries at which theaccumulation amounts are not zero, are re-numbered (as two, three, andso forth), starting with an entry that has the smallest generationnumber, excepting for the entries that are merged. That is, thegeneration number at entry 2 is updated from one to two.

FIG. 26G illustrates a state of the long sequential determination tablewhen the WRITE STREAM command (command F) designating the transferlength=0x100 sectors from start LBA=0x0F00 is issued in a state in FIG.26F. The start LBA of command F is contiguous to the end LBA at entry 2.Furthermore, the end LBA of command F is contiguous to the start LBA atentry 0. At this time, information at entry 0, information at entry 2,and information of command F are merged, and a result of the merging isregistered at an entry at which the start LBA is smallest, that is, atentry 2. The start LBA at entry 2 remains 0x0E00. The end LBA at entry 2is updated to 0x15FF, which is the end LBA at entry 0. The accumulationamount at entry 2 results from adding the accumulation amount at entry 0(0x600) and the number of transfers of command F (0x100) to the existingaccumulation amount (0x100), and thus is updated to 0x800. At theentries that are merged, the generation number at the entry at which thestart LBA is smallest is one. That is, the generation number at entry 2is updated to one. Among the entries that are merged, the entry at whichthe start LBA is not smallest is initialized. That is, entry 0 isinitialized.

At this point, because the accumulation amount at entry 2 is equal to orlarger than the long sequential determination threshold value (0x700),the long determination flag is set.

Upon receiving commands, in a case where when the numbers ofaccumulations at all entries are not zero, the LBA range of the receivedcommands is non-contiguous to the start LBA or the end LBA at any entry,an entry that has the largest generation number is initialized. It isnoted that, in this case, an entry that has the smallest accumulationamount may be initialized. Then, information of the received command isregistered at the initialized entry.

Next, a procedure in which the stream control unit 220 according to thesecond embodiment updates the long sequential determination table isdescribed with reference to FIG. 27.

When receiving the WRITE STREAM command (S300), the stream control unit220 determines whether or not there is an entry at which theaccumulation amount is not zero and the start LBA or the end LBA iscontiguous to the LBA range of the received command (S301).

In a case where there is no entry at which the LBA is contiguous (No inS301), the stream control unit 220 determines whether or not there is anentry at which the accumulation amount is zero (S302). In a case wherethere is the entry at which the accumulation amount is zero (Yes inS302), the stream control unit 220 registers the command information atthe entry that has the smallest entry number (S303), among entries atwhich the accumulation amount is zero. At this time, the generationnumber of the entry is set to one. In a case where there is no entry atwhich the accumulation amount is zero (No in S302), the stream controlunit 220 initializes the entry that has the largest generation number orhas the smallest accumulation amount (S304).

In a case where there is the entry at which LBA is contiguous (Yes inS301), the stream control unit 220 determines whether or not there areentries that are able to be merged (S305). That is, it is determinedwhether or not there are both an entry (a first entry) that has the endLBA which is contiguous to the start LBA of the received command, and anentry (a second entry) that has the start LBA which is contiguous to theend LBA of the received command.

In a case where there are no entries that are able to be merged, thatis, in a case where there is only one of the first entry and the secondentry (No in S305), the stream control unit 220 registers the commandinformation at the first entry or the second entry (S306). Specifically,in a first case where the command information is registered at the firstentry, the end LBA of the received command is registered as the end LBAat the first entry, without changing the start LBA at the first entry.Furthermore, in a second case where the command information isregistered at the second entry, the start LBA of the received command isregistered as the start LBA at the second entry, and the end LBA at thesecond entry is not changed. In any of the first case and the secondcase, the transfer length of the received command is added to theaccumulation amount at the entry, and the generation number at the entryis set to one. Furthermore, at an entry that is not a registrationtarget, the generation number at the entry at which the accumulationamount is not zero, is incremented by one (S307).

In a case where there are the entries that are able to be merged, thatis, in a case where there are both of the first entry and the secondentry (Yes in S305), the stream control unit 220 registers informationof the second entry and the command information, at the first entry, bymerging them (S308). That is, the start LBA at the first entry is notchanged. The end LBA at the second entry is registered as the end LBA atthe first entry. A value which results from adding the transfer lengthof the received command to a sum of the accumulation amount at the firstentry and the accumulation amount at the second entry is registered asthe accumulation amount at the first entry. The generation number at thefirst entry is set to one. Furthermore, the generation numbers at theentries at which the accumulation amounts are not zero, are re-numbered(as two, three, and so forth) in ascending order of the generationnumber, excepting for the merging target entries (S309).

It is noted that, in any of the case where there are no entries that areable to be merged (No in S305) and the case where there are the entriesthat are able to be merged (Yes in S305), there is a case where thereare two or more first entries or a case where there are two or moresecond entries. In these cases, the stream control unit 220, forexample, selects any one of the two or more first entries (or the two ormore second entries), and performs the processing described above.

Next, the stream control unit 220 determines whether or not any entry atwhich the accumulation amount is equal to or larger than the longsequential determination threshold value exists (S310), and in a casewhere there is an entry that has such accumulation amount (Yes in S310),sets the long determination flag (S311).

Next, one example of a configuration of the stream/thread conversiontable 232 according to the second embodiment is described with referenceto FIG. 28.

According to the second embodiment, the long determination flag is addedto the stream/thread conversion table 232 of the first embodiment. It isnoted that the long determination flag, along with the stream ID, isinput into the stream/thread conversion unit 230 from the stream controlunit 220.

As illustrated in FIG. 28, the long determination flag is not set forstream IDs=5 and 7. At this time, according to the thread allocationconditions described in the first embodiment, stream IDs=5 and 7 thathave the fifth and seventh ranked priority levels, respectively, aredefined as having to be allocated to threads #5 and #7, respectively,which are the dedicated threads. However, thread determination unit 234according to the present embodiment allocates stream IDs=5 and 7 forwhich the long determination flag is not set, to thread #8, which is themixing thread, regardless of the priority level. As a result, streamIDs=6, 8, and 9 that have the sixth, eighth, and ninth ranked prioritylevels, respectively, are allocated to threads #5, thread #6, and thread#7, respectively, which are the dedicated threads.

It is noted that the stream IDs for which the long determination flag isnot set are allocated to the mixing thread regardless of the prioritylevel. Instead, the priority level of such stream IDs that is determinedfrom the host throughput, may be lowered. Furthermore, in a case wherethe host 2 determines a priority level (the case of S200 in FIG. 19),the host 2 may determine the priority level in accordance with thesequentiality of the stream data. In a case where the semiconductorstorage device 1 determines the priority level (the case of S202 in FIG.19), the host 2 may notify the semiconductor storage device 1 of thesequentiality of the stream data. In this case, the sequentiality isnotified to the semiconductor storage device 1, for example, by theSTREAM CONTROL (OPEN) command.

According to the semiconductor storage device according to the secondembodiment, the WAF of the semiconductor storage device can be reducedbecause a dedicated thread is allocated with higher priority to thestream ID that has higher sequentiality.

Third Embodiment

In a semiconductor storage device according to a third embodiment, thesemiconductor storage device 1 by itself assigns a stream ID to eachpiece of data based on data sequentiality. That is, according to thethird embodiment, each piece of stream data is suitably allocated toeach thread even when communicating with a host that does not transmitthe stream data explicitly.

Same as in the manner in the second embodiment, in the semiconductorstorage device 1 according to the third embodiment, the stream controlunit 220 determines the sequentiality using the start LBA and thetransfer length that are input from the host IF control unit 100. Analgorithm that is used for the determination of the sequentiality is thesame as that in the second embodiment. That is, when the accumulationamount of data that is sequentially linked from a reference start LBA isequal to or larger than the long sequential determination thresholdvalue, the stream control unit 220 determines that the datasequentiality is high. According to the third embodiment, the streamcontrol unit 220 adds the stream ID to the data for which sequentialityis determined to be high.

In the semiconductor storage device 1 according to the secondembodiment, there is one long sequential determination table for onestream ID. In contrast, according to the third embodiment, the datasequentiality is determined with reference to one long sequentialdetermination table that is built into the stream control unit 220.

FIG. 29A to 29H illustrate one example of the configuration of the longsequential determination table. The long sequential determination tablehas a plurality of entries (rows). Here, the long sequentialdetermination table has three entries. Each entry includes start LBA,end LBA, the accumulation amount, a generation number, and a stream ID.The long sequential determination table may be initialized by the CPU500 at a predetermined timing. In the following description, it isassumed that 0x700 is set for the long sequential determinationthreshold value.

FIG. 29A illustrates a state in which the long sequential determinationtable is initialized. Although omitted in FIG. 29A, the start LBA, theend LBA, the accumulation amount, the generation number, and the streamID of all entries are zero.

FIGS. 29B to 29F are conceptually similar to FIGS. 26B and 26F,respectively, and thus repeated description thereof is omitted.According to the third embodiment, a general command used for the datawrite (a WRITE command), including the WRITE STREAM command, is adetermination target of the sequentiality.

FIG. 29G illustrates a state of the long sequential determination tablewhen the WRITE command (command F) designating the transfer length=0x200sectors from start LBA=0x2000 is issued in a state in FIG. 29F. Thestart LBA of command F is not contiguous to any one of the end LBA atentry 0 and the end LBA at entry 2. At this time, information of commandF is registered at entry 1. The start LBA at entry 1 is set as 0x2000,and the end LBA is set as 0x21FF. The accumulation amount at entry 1results from adding the number of transfers of command F (0x200) to theexisting accumulation amount (0x000), and thus is set as 0x200. Thegeneration number at the entry at which the command information is newlyregistered is one. That is, the generation number at entry 1 is set asone. At entries at which the accumulation amount is not zero other thanthe entry at which the command information is newly registered, thegeneration number is incremented by one. That is, the generation numberat entry 0 is updated to two, and the generation number at entry 2 isupdated to three.

FIG. 29H illustrates a state of the long sequential determination tablewhen the WRITE command (command G) designating the transfer length=0x100sectors from start LBA=0x0F00 is issued in a state in FIG. 29G. Thestart LBA of command G is contiguous to the end LBA at entry 2.Furthermore, the end LBA of command F is contiguous to the start LBA atentry 0. At this time, information at entry 0, information at entry 2,and information of command F are merged, and a result of the merging isregistered at an entry at which the start LBA is smallest, that is, atentry 2. The start LBA at entry 2 remains 0x0E00. The end LBA at entry 2is updated to 0x15FF that is the end LBA at entry 0. The accumulationamount at entry 2 results from adding the accumulation amount at entry 0(0x600) and the number of transfers of command F (0x100) to the existingaccumulation amount (0x100), and thus is updated to 0x800. At theentries that are merged, the generation number at the entry at which thestart LBA is smallest is one. That is, the generation number at entry 2is set as one. Among the entries that are merged, the entry at which thestart LBA is not smallest is initialized. That is, entry 0 isinitialized. The generation numbers of the entries at which theaccumulation amounts are not zero, are re-numbered (as two, three, andso forth), starting with an entry that has the smallest generationnumber, excepting for the entries that are merged. That is, thegeneration number at entry 1 is updated from one to two.

At this point, because the accumulation amount at entry 2 is equal to orlarger than the long sequential determination threshold value (0x700), astream ID is assigned to entry 2. Any stream ID may be assigned, but atthis point, one is allocated. The stream ID is assigned to data thatbelongs to the entry to which the stream ID is assigned.

The stream ID is not assigned to random write data that belongs to anentry of which the accumulation amount is smaller than the longsequential determination threshold value. That is, the stream controlunit 220 according to the present embodiment can separate the streamdata and the random write data from among data of a plurality of WRITEcommands that are received.

Upon reception of WRITE commands thereafter, if the accumulation amountis equal to or larger than the long sequential determination thresholdvalue, a different stream ID (for example, two) is assigned to entry 1in the same manner. That is, the stream control unit 220 according tothe third embodiment can extract a plurality of pieces of stream datafrom data of the plurality of WRITE commands that are received and canassign different stream IDs.

The stream/thread conversion unit 230 according to the third embodimentperforms the allocation of the thread 800 in the same manner as in thefirst embodiment, based on the stream ID that is assigned to each pieceof data by the stream control unit 220 as described above. That is, adedicated thread 800 is allocated with higher priority to the stream IDthat has higher host throughput. Furthermore, the stream/threadconversion unit 230 allocates random write data to the mixing thread.

According to the semiconductor storage device according to the thirdembodiment, as described above, because the semiconductor storage deviceassigns the stream IDs and allocates the threads to the stream IDs thathave higher sequentiality and higher host throughput, the WAF of thesemiconductor storage device can be reduced even when communicating withthe host that does not transmit the stream data explicitly.

Fourth Embodiment

In the semiconductor storage device according to the first embodiment,in order to reduce the WAF, a higher priority level is allocated to thestream ID that has a higher host throughput, and according to thepriority level, a thread is allocated. In contrast, in the semiconductorstorage device according to the fourth embodiment, in order to improve athroughput between the semiconductor storage device and the host, thethread is allocated in accordance with a maximum throughput of eachthread.

Here, a maximum throughput of each thread 800 is referred to as amaximum thread throughput. The maximum thread throughput is determinedbased on the ability to transfer data from the memory controller 10 tothe NAND flash memory 20. The maximum thread throughput may be the sameamong the threads 800 or may vary from one thread 800 to another. Insome instances, the maximum thread throughput can be lower than thehighest possible operational throughput. For example, when thesemiconductor storage device 1 is set to be in a low power consumptionmode, or the like, the maximum thread throughput may be lower than thatduring a normal operation mode. Furthermore, the maximum threadthroughput changes also depending on the number of channels between thememory controller 10 and the NAND flash memory 20 in which the writedata are written via the thread 800, or on the number of bankinterleaves.

The host throughput according to the fourth embodiment is determined inthe same manner as in the first embodiment.

FIG. 30 illustrates an example of the allocation of the thread 800 by astream/thread conversion unit 230 according to the fourth embodiment.Like in FIG. 13, for simplification, it is assumed that thesemiconductor storage device 1 has a maximum of four threads 800.

Host throughputs of stream IDs=1 to 5 are the same as in the case inFIG. 13. A maximum thread throughput of thread #1 is 1200 MB/s. Amaximum thread throughput of thread #2 is 1150 MB/s. A maximum threadthroughput of thread #3 is 1100 MB/s. A maximum thread throughput ofthread #4 is 1000 MB/s.

The stream/thread conversion unit 230 allocates five stream IDs to fourthreads 800. The stream/thread conversion unit 230, with higherpriority, allocates the stream ID that has higher host throughput, tothe thread 800 that has higher maximum thread throughput. That is,stream ID=1 that has the highest host throughput is allocated to thread#1 that has the highest maximum thread throughput. That is, stream ID=2that has the second highest host throughput is allocated to thread #2that has the second highest maximum thread throughput. That is, streamID=3 that has the third highest host throughput is allocated to thread#3 that has the third highest maximum thread throughput. Stream IDs 4and 5 that have the fourth and fifth highest host throughputs,respectively, are allocated to thread #4 in a mixed/joint manner.

As a result of allocating the stream IDs to the threads 800,respectively, in this manner, an effective thread throughput of thread#1 is 1200 MB/s. An effective thread throughput of thread #2 is 1100MB/s. An effective thread throughput of thread #3 is 1000 MB/s. Aneffective thread throughput of thread #4 is 900 MB/s. A sum of theeffective thread throughputs is 4200 MB/s.

Next, an example of the allocation of the thread 800 by a stream/threadconversion unit 230 according to a comparative example is described withreference to FIG. 31.

The host throughputs of the stream data are the same as in the case inFIG. 30. The maximum thread throughput of each thread 800 is also thesame as in the case in FIG. 30. The stream/thread conversion unit 230 inthe comparative example allocates stream ID=1 that has the highest hostthroughput, and stream ID=2 that has the second highest host throughput,to thread #1 in a mixed/joint manner. Furthermore, the stream/threadconversion unit 230 in the comparative example allocates stream IDs=3,4, and 5 that have the third and later highest host throughputs, tothread #2, thread #3, and thread #4, respectively.

As a result of allocating the stream IDs to the threads 800,respectively, in this manner, an effective thread throughput of thread#1 is 1200 MB/s. An effective thread throughput of thread #2 is 1000MB/s. An effective thread throughput of thread #3 is 500 MB/s. Aneffective thread throughput of thread #4 is 400 MB/s. A sum of theeffective thread throughputs is 3100 MB/s, which is lower than in thecase with the fourth embodiment. That is, performance decreases in thecomparative example.

Next, another example of the allocation of the thread 800 by thestream/thread conversion unit 230 according to the fourth embodiment isdescribed with reference to FIG. 32.

The host throughputs of stream IDs=1 to 5 are the same as in the case inFIG. 30. A maximum thread throughput of thread #1 is 800 MB/s. A maximumthread throughput of thread #2 is 750 MB/s. A maximum thread throughputof thread #3 is 700 MB/s. A maximum thread throughput of thread #4 is650 MB/s. In the case of FIG. 32, the maximum thread throughput is lowerthan the host throughput.

The stream/thread conversion unit 230 allocates five stream IDs to fourthreads 800. The stream/thread conversion unit 230, with higherpriority, allocates the stream ID that has higher host throughput, tothe thread 800 that has higher maximum thread throughput. That is,stream ID=1 that has the highest host throughput is allocated to thread#1 that has the highest maximum thread throughput. That is, stream ID=2that has the second highest host throughput is allocated to thread #2that has the second highest maximum thread throughput. That is, streamID=3 that has the third highest host throughput is allocated to thread#3 that has the third highest maximum thread throughput. Pieces ofstream data that have stream IDs 4 and 5 which have the fourth and fifthhighest host throughputs, respectively, are allocated to thread #4 in amixed/joint manner.

As a result of allocating the stream IDs to the threads 800,respectively, in this manner, an effective thread throughput of thread#1 is 800 MB/s. An effective thread throughput of thread #2 is 750 MB/s.An effective thread throughput of thread #3 is 700 MB/s. An effectivethread throughput of thread #4 is 650 MB/s. A sum of the effectivethread throughputs is 2900 MB/s.

Next, the same example of the allocation of the thread 800 by astream/thread conversion unit 230 according to a comparative example isdescribed with reference to FIG. 33.

The host throughputs of the stream data are the same as in the case inFIG. 32. The maximum thread throughput of each thread 800 is also thesame as in the case in FIG. 32. The stream/thread conversion unit 230 inthe comparative example allocates stream ID=1 that has the highest hostthroughput, and stream ID=2 that has the second highest host throughput,to thread #1 in a mixed/joint manner. Furthermore, the stream/threadconversion unit 230 in the comparative example allocates pieces ofstream data that have stream IDs=3, 4, and 5 that have the third, andlater highest host throughputs, to thread #2, thread #3, and thread #4,respectively.

As a result of allocating the stream IDs to the threads 800,respectively, in this manner, an effective thread throughput of thread#1 is 800 MB/s. An effective thread throughput of thread #2 is 750 MB/s.An effective thread throughput of thread #3 is 500 MB/s. An effectivethread throughput of thread #4 is 400 MB/s. A sum of the effectivethread throughputs is 2450 MB/s, which is lower than in the case of thepresent embodiment. That is, performance decreases in the comparativeexample.

Next, an algorithm for the allocation of the thread 800 by thestream/thread conversion unit 230 according to the present embodiment isdescribed with reference to FIGS. 34 to 35.

The host throughputs of stream IDs=1 to 5 are defined as Qs 1 to Qs5,respectively. Maximum thread throughputs of thread #1 to thread #4 aredefined as T1 to T4, respectively.

First, as illustrated in FIG. 34, it is assumed that stream ID=1, streamID=2, stream ID=3, and stream ID=4 and stream ID=5 are allocated tothread #1, thread #2, thread #3, and thread #4, respectively. In thiscase, an effective thread throughput Qt1 of thread #1 is Qt1=min (Qs1,T1). An effective thread throughput Qt2 of thread #2 is Qt2=min (Qs2,T2). An effective thread throughput Qt3 of thread #3 is Qt3=min (Qs3,T3). An effective thread throughput Qt4 of thread #4 is Qt4=min(Qs4+Qs5, T4).

Next, as illustrated in FIG. 35, it is assumed that stream ID=1, streamID=2, stream ID=3 and stream ID=4, and stream ID=5 are allocated tothread #1, thread #2, thread #3, and thread #4, respectively. In thiscase, an effective thread throughput Qt1 of thread #1 is Qt1=min (Qs1,T1). An effective thread throughput Qt2 of thread #2 is Qt2=min (Qs2,T2). An effective thread throughput Qt3 of thread #3 is Qt3=min(Qs3+Qs4, T3). An effective thread throughput Qt4 of thread #4 isQt4=min (Qs5, T4).

The stream/thread conversion unit 230 selects a combination in which asum of the effective thread throughputs, that is, Qt1+Qt2+Qt3+Qt4 ismaximized, from among combinations of stream IDs that are allocated tothe threads 800 as described above.

Moreover, in a case where there is a plurality of combinations in whichthe sum of the effective thread throughputs is at maximum, the dedicatedthread 800, if possible, is allocated to the stream ID that has a highhost throughput. As described in the first embodiment, this is becausethe WAF increases when a plurality of stream IDs that have a high hostthroughput is allocated to one thread 800.

According to the semiconductor storage device according to the fourthembodiment, as described above, the performance of the semiconductorstorage device can be improved because the thread is allocated in such amanner that the sum of the effective thread throughputs is maximized.

According to the semiconductor storage device according to at least oneembodiment, as described above, because a write destination of thestream data can be suitably selected in the nonvolatile semiconductormemory, reliability and performance of the semiconductor storage devicecan be improved.

While certain embodiments have been described, these embodiments havebeen presented by way of example only, and are not intended to limit thescope of the inventions. Indeed, the novel embodiments described hereinmay be embodied in a variety of other forms; furthermore, variousomissions, substitutions and changes in the form of the embodimentsdescribed herein may be made without departing from the spirit of theinventions. The accompanying claims and their equivalents are intendedto cover such forms or modifications as would fall within the scope andspirit of the inventions.

What is claimed is:
 1. A memory system connectable with a host, thememory system comprising: a nonvolatile memory including a plurality ofblocks, each of the plurality of blocks being a unit for a data eraseoperation; and a controller electrically connected with the nonvolatilememory and configured to: assign N stream identifiers for use by thehost, where N is an integer greater than two; in response to receiving,from the host, N pieces of stream data respectively associated with Nstream identifiers: store M pieces of stream data into M first blocksrespectively, where M is an integer smaller than N, and where the Mpieces of stream data correspond to highest M priority levels amongpriority levels corresponding to the N pieces of stream data; and storea plurality of pieces of stream data into a single second block, each ofthe plurality of pieces of stream data corresponding to a priority levellower than any of the highest M priority levels, the plurality of piecesof stream data including at least a piece of first stream data and apiece of second stream data, the piece of first stream datacorresponding to a lowest priority level among the priority levelscorresponding to the N pieces of stream data, the piece of second streamdata corresponding to a next-lowest priority level among the prioritylevels corresponding to the N pieces of stream data; and in a garbagecollection operation, in a case where the first stream data isinvalidated and the second stream data is not invalidated, copy thepiece of second stream data from the second block to a third blockbefore performing the data erase operation on the second block; and in acase where the first stream data is not invalidated and the secondstream data is invalidated, copy the piece of first stream data from thesecond block to a fourth block before performing the data eraseoperation on the second block.
 2. The memory system according to claim1, wherein the priority level is assigned to each of the N pieces ofstream data in accordance with a data throughput of each of the N piecesof stream data.
 3. The memory system according to claim 2, wherein thedata throughput is a throughput between the host and the memory system.4. The memory system according to claim 3, wherein the controller isfurther configured to measure the data throughput of each of the Npieces of stream data.
 5. The memory system according to claim 2,wherein a data throughput of each of the M pieces of stream data ishigher than a data throughput of each of the plurality of pieces ofstream data.
 6. The memory system according to claim 1, wherein thepriority level is assigned to each of the N pieces of stream data inaccordance with a sequentiality of logical addresses associatedtherewith.
 7. The memory system according to claim 6, wherein asequentiality of logical addresses associated with each of the M piecesof stream data is higher than a sequentiality of logical addressesassociated with each of the plurality of pieces of stream data.
 8. Thememory system according to claim 6, wherein the sequentiality of logicaladdresses associated with each of the N pieces of stream data isindicated in a command issued by the host.
 9. The memory systemaccording to claim 1, wherein the priority level is assigned to each ofthe N pieces of stream data in accordance with a command issued by thehost.
 10. The memory system according to claim 1, wherein stream dataassociated with a same stream identifier is expected to be invalidatedat one time.
 11. The memory system according to claim 1, wherein streamdata associated with different stream identifiers are expected to beinvalidated at different times.
 12. The memory system according to claim1, wherein the controller is configured to assign the N streamidentifiers for use by the host in response to receiving a command fromthe host.
 13. The memory system according to claim 1, wherein thecontroller includes (M+1) threads, each of the (M+1) threads including abuffer, and the controller is further configured to: store each of the Mpieces of stream data into the buffer of each of M threads beforestoring the M pieces of stream data into the M first blocksrespectively; and store the plurality of pieces of stream data into thebuffer of one thread different from the M threads before storing theplurality of pieces of stream data into the second block.
 14. A memorysystem connectable with a host, the memory system comprising: anonvolatile memory including a plurality of blocks, each of theplurality of blocks being a unit for a data erase operation; and acontroller electrically connected with the nonvolatile memory andconfigured to: assign N stream identifiers for use by the host, where Nis an integer greater than two; in response to receiving, from the host,N pieces of stream data respectively associated with N streamidentifiers: store M pieces of stream data into M first blocksrespectively, where M is an integer smaller than N, and the M pieces ofstream data correspond to highest M data throughputs among datathroughputs corresponding to the N pieces of stream data; and store aplurality of pieces of stream data into a single second block, each ofthe plurality of pieces of stream data corresponding to a datathroughput lower than any of the highest M data throughputs, theplurality of pieces of stream data including at least a piece of firststream data and a piece of second stream data, the piece of first streamdata corresponding to a lowest data throughput among the datathroughputs corresponding to the N pieces of stream data, the piece ofsecond stream data corresponding to a next-lowest data throughput amongthe data throughputs corresponding to the N pieces of stream data; andin a garbage collection operation, in a case where the first stream datais invalidated and the second stream data is not invalidated, copy thepiece of second stream data from the second block to a third blockbefore performing the data erase operation on the second block; and in acase where the first stream data is not invalidated and the secondstream data is invalidated, copy the piece of first stream data from thesecond block to a fourth block before performing the data eraseoperation on the second block.
 15. The memory system according to claim14, wherein the data throughput of each of the N pieces of stream datais a data throughput between the host and the memory system.
 16. Thememory system according to claim 15, wherein the controller is furtherconfigured to measure the data throughput of each of the N pieces ofstream data.
 17. The memory system according to claim 14, wherein streamdata associated with a same stream identifier is expected to beinvalidated at one time.
 18. The memory system according to claim 14,wherein stream data associated with different stream identifiers areexpected to be invalidated at different times.
 19. The memory systemaccording to claim 14, wherein the controller is configured to assignthe N stream identifiers for use by the host in response to receiving acommand from the host.
 20. The memory system according to claim 14,wherein the controller includes (M+1) threads, each of the (M+1) threadsincluding a buffer, and the controller is further configured to: storeeach of the M pieces of stream data into the buffer of each of M threadsbefore storing the M pieces of stream data into the M first blocksrespectively; and store the plurality of pieces of stream data into thebuffer of one thread different from the M threads before storing theplurality of pieces of stream data into the second block.